package controller;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

import com.example.myfirstapp.R;

import java.util.List;

public class TextAdapter extends ArrayAdapter<String> {

    private int resourceId;

    public TextAdapter(Context context, int textViewId, String[] data) {
        super(context, textViewId, data);
        this.resourceId = textViewId;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

        String mes = getItem(position);

        View view = LayoutInflater.from(getContext()).inflate(resourceId, parent, false);

        TextView talkFlow = (TextView) view.findViewById(R.id.inner_text);

        talkFlow.setText(mes);

        return view;
    }
}
